XML Basics - Part 2


An XML element should first describe its contents in the broadest possible terms, and then drill down to reveal more information. The following XML fragment illustrates this:

<chapter>   <chapternumber>Six</chapternumber>   <chaptertitle>XML As Data</chaptertitle>   <levelonehead>Data Typing in XML</levelonehead></chapter>

The 'chapter' element is generic, and the other elements hold particular information. Each of these elements serves as a container. Every XML document has a primary container, the document element), which holds every other container. When authoring your document element, keep in mind these rules:

  1. There is always only one document element in an XML document.
  2. Following any opening declarations, the document element is always the first element in an XML document.
  3. The document element's closing tag is never followed by another element's closing tag.
  4. There must be case agreement between the start and end tags (this is required for any element).

NOTE: Any well-formed XML document must be comprised of elements that form a simple hierarchical tree, with a single node called the document root. This node contains a secondary tree of elements, also with a single root node called the document element. Because the document root and the document element and not the same thing, it is best not to refer to the document element as the "root element" (even though it is the root of the element sub-tree).

Copyright 2000 Extensibility, Inc.

Suite 250, 200 Franklin Street, Chapel Hill, North Carolina 27516